﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

public partial class Controls_MenuSanPham : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
            Literal1.Text = LoadMenu();

    }

    private string LoadMenu()
    {
        string htmlMenu = "";
        ChoDienTuDataContext cdt = new ChoDienTuDataContext();
        var list = cdt.Select_AllCategory();
       
        foreach (var cat in list)
        {
            htmlMenu += "<li>";
            htmlMenu += "<a href='CategoryDetail.aspx?catId="+cat.ID+"'>" + cat.CategoryName + "</a>";
            
            htmlMenu += "</li>";
        }
       
        return htmlMenu;
    }
}